#include<bits/stdc++.h>
using namespace std;

int guess(int x){}

void guessnumber(int n)
{
    int left = 1, right = n;
    // 循环条件：当左右边界不重合时继续查找
    while (left < right)
    {
        // 关键修复：mid向上取整，避免left永远追不上right的情况
        int mid = left + (right - left + 1) / 2;
        int res = guess(mid);
        if (res == 1)
        {
            // x >= mid：目标数在[mid, right]，更新左边界为mid
            left = mid;
        }
        else
        {
            // res == 0（x < mid）：目标数在[left, mid-1]，更新右边界为mid-1
            right = mid - 1;
        }
    }
    // 循环结束时，left == right，即为目标数x
    printf("%d\n", left);
}